/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.ultrasoft.farmasoft.domain;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.Lob;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author Administrador
 */
@Entity
@Table(name = "paymentplan")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "Paymentplan.findAll", query = "SELECT p FROM Paymentplan p"),
    @NamedQuery(name = "Paymentplan.findByPaymentPlanId", query = "SELECT p FROM Paymentplan p WHERE p.paymentPlanId = :paymentPlanId"),
    @NamedQuery(name = "Paymentplan.findByAccountsPayableId", query = "SELECT p FROM Paymentplan p WHERE p.accountsPayableId.accountsPayableId = :accountsPayableId"),
    @NamedQuery(name = "Paymentplan.findByAccountReceivableId", query = "SELECT p FROM Paymentplan p WHERE p.accountReceivableId.accountReceivableId = :accountReceivableId"),
    @NamedQuery(name = "Paymentplan.findByManyPay", query = "SELECT p FROM Paymentplan p WHERE p.manyPay = :manyPay"),
    @NamedQuery(name = "Paymentplan.findByAmount", query = "SELECT p FROM Paymentplan p WHERE p.amount = :amount"),
    @NamedQuery(name = "Paymentplan.findByExpirationDate", query = "SELECT p FROM Paymentplan p WHERE p.expirationDate = :expirationDate"),
    @NamedQuery(name = "Paymentplan.findByPaymentDate", query = "SELECT p FROM Paymentplan p WHERE p.paymentDate = :paymentDate"),
    @NamedQuery(name = "Paymentplan.findByActive", query = "SELECT p FROM Paymentplan p WHERE p.active = :active"),
    @NamedQuery(name = "Paymentplan.findByPaid", query = "SELECT p FROM Paymentplan p WHERE p.paid = :paid")})
public class Paymentplan implements Serializable {
    private static final long serialVersionUID = 1L;
    /*
    @Id
    @Basic(optional = false)
    @Column(name = "paymentPlanId")
    */
    @Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
    private Short paymentPlanId;
    @Basic(optional = false)
    @Column(name = "manyPay")
    private boolean manyPay;
    @Basic(optional = false)
    @Column(name = "amount")
    private float amount;
    @Column(name = "expirationDate")
    @Temporal(TemporalType.DATE)
    private Date expirationDate;
    @Column(name = "paymentDate")
    @Temporal(TemporalType.DATE)
    private Date paymentDate;
    @Basic(optional = false)
    @Column(name = "active")
    private boolean active;
    @Basic(optional = false)
    @Column(name = "paid")
    private boolean paid;
    @Lob
    @Column(name = "detail")
    private String detail;    
    @Column(name = "paymentTypeId")
    private short paymentTypeId;
    @Column(name = "tempFrequencyPayment")
    private short tempFrequencyPayment;
	@JoinColumn(name = "accountReceivableId", referencedColumnName = "accountReceivableId")
    @ManyToOne
    private Accountreceivable accountReceivableId;
    @JoinColumn(name = "accountsPayableId", referencedColumnName = "accountsPayableId")
    @ManyToOne
    private Accountspayable accountsPayableId;

    public Paymentplan() {
    }

    public Paymentplan(Short paymentPlanId) {
        this.paymentPlanId = paymentPlanId;
    }

    public Paymentplan(Short paymentPlanId, boolean manyPay, float amount, boolean active, boolean paid) {
        this.paymentPlanId = paymentPlanId;
        this.manyPay = manyPay;
        this.amount = amount;
        this.active = active;
        this.paid = paid;
    }

    public Short getPaymentPlanId() {
        return paymentPlanId;
    }

    public void setPaymentPlanId(Short paymentPlanId) {
        this.paymentPlanId = paymentPlanId;
    }

    public boolean getManyPay() {
        return manyPay;
    }

    public void setManyPay(boolean manyPay) {
        this.manyPay = manyPay;
    }

    public float getAmount() {
        return amount;
    }

    public void setAmount(float amount) {
        this.amount = amount;
    }

    public Date getExpirationDate() {
        return expirationDate;
    }

    public void setExpirationDate(Date expirationDate) {
        this.expirationDate = expirationDate;
    }

    public Date getPaymentDate() {
        return paymentDate;
    }

    public void setPaymentDate(Date paymentDate) {
        this.paymentDate = paymentDate;
    }

    public boolean getActive() {
        return active;
    }

    public void setActive(boolean active) {
        this.active = active;
    }

    public boolean getPaid() {
        return paid;
    }

    public void setPaid(boolean paid) {
        this.paid = paid;
    }

    public String getDetail() {
        return detail;
    }

    public void setDetail(String detail) {
        this.detail = detail;
    }

    public short getPaymentTypeId() {
		return paymentTypeId;
	}

	public void setPaymentTypeId(short paymentTypeId) {
		this.paymentTypeId = paymentTypeId;
	}

	public short getTempFrequencyPayment() {
		return tempFrequencyPayment;
	}

	public void setTempFrequencyPayment(short tempFrequencyPayment) {
		this.tempFrequencyPayment = tempFrequencyPayment;
	}
    
    public Accountreceivable getAccountReceivableId() {
        return accountReceivableId;
    }

    public void setAccountReceivableId(Accountreceivable accountReceivableId) {
        this.accountReceivableId = accountReceivableId;
    }

    public Accountspayable getAccountsPayableId() {
        return accountsPayableId;
    }

    public void setAccountsPayableId(Accountspayable accountsPayableId) {
        this.accountsPayableId = accountsPayableId;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (paymentPlanId != null ? paymentPlanId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Paymentplan)) {
            return false;
        }
        Paymentplan other = (Paymentplan) object;
        if ((this.paymentPlanId == null && other.paymentPlanId != null) || (this.paymentPlanId != null && !this.paymentPlanId.equals(other.paymentPlanId))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "com.ultrasoft.farmasoft.domain.Paymentplan[ paymentPlanStudentId=" + paymentPlanId + " ]";
    }
    
}
